# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Kevin <kevin@archlinux.org>
# Contributor: criminy <criminy@gmail.com>

pkgbase=cairomm-1.16
pkgname=(
  cairomm-1.16
  cairomm-1.16-docs
)
pkgver=1.18.0
pkgrel=1
pkgdesc="C++ bindings for Cairo"
url="https://www.cairographics.org/cairomm/"
arch=(loong64 x86_64)
license=(
  LGPL
  MPL
)
depends=(
  cairo
  libsigc++-3.0
)
makedepends=(
  git
  meson
  mm-common
)
options=(!emptydirs)
_commit=e0bad547705348657d09db4c9375833d8890cf54  # tags/1.18.0^0
source=("git+https://gitlab.freedesktop.org/cairo/cairomm.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd cairomm
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd cairomm
}

build() {
  local meson_options=(
    -D maintainer-mode=true
  )

  arch-meson cairomm build "${meson_options[@]}"
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_cairomm-1.16() {
  depends+=(libsigc-3.0.so)
  provides=(libcairomm-1.16.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_cairomm-1.16-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}

# vim:set sw=2 sts=-1 et:
